public class Solution1010 {
    public int numPairsDivisibleBy60(int[] time) {
        int[] t=new int[60];
        int ans=0;
        for (int i : time) {
            ans=ans+t[(60-i%60)%60];
            t[i%60]++;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1010().numPairsDivisibleBy60(new int[]{30,20,150,100,40}));
    }
}
